Imports System
Imports System.Data
Imports System.Data.Common
Imports System.Collections.Generic
Imports Microsoft.Practices.EnterpriseLibrary.Data

Namespace DAL.Servicio
    Public Class Encuesta
        Public Function Listar() As DataTable
            Dim ds As New DataSet()
            Dim db As Database = DatabaseFactory.CreateDatabase()
            Dim cm As System.Data.Common.DbCommand = db.GetStoredProcCommand("[SER_S_Encuesta]")

            Try
                ds = db.ExecuteDataSet(cm)
                ds.Tables(0).TableName = "TIPOS"
                Return ds.Tables(0)
            Catch ex As System.Data.SqlClient.SqlException
                Throw New Exception(ex.Message, ex.InnerException)
            End Try
        End Function
        Public Function ListarEstructura(ByVal intId As Integer) As DataTable
            Dim ds As New DataSet()
            Dim db As Database = DatabaseFactory.CreateDatabase()
            Dim cm As System.Data.Common.DbCommand = db.GetStoredProcCommand("[SER_S_Encuesta_Estructura]")
            db.AddInParameter(cm, "CO_ENCUESTA_EX", DbType.Int32, intId)
            Try
                ds = db.ExecuteDataSet(cm)
                ds.Tables(0).TableName = "ENCUESTA"
                Return ds.Tables(0)
            Catch ex As System.Data.SqlClient.SqlException
                Throw New Exception(ex.Message, ex.InnerException)
            End Try
        End Function
    End Class
End Namespace